package com.acwing.partition20;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/4/28 9:42
 */
public class AC1912里程表 {

    private static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        long x = nextLong(), y = nextLong();
        int ans = 0;
        //枚举位数，再枚举两个不同的数，枚举存放的位置判断是否在区间范围内
        for (int i = 3; i <= 17; i++) {
            for (int j = 0; j < 10; j++) {
                for (int k = 0; k < 10; k++) {
                    if (j == k) continue;
                    for (int u = 0; u < i; u++) {
                        StringBuilder sb = new StringBuilder();
                        for (int c = 0; c < i; c++) sb.append((char) (j + '0'));
                        sb.setCharAt(u, (char) (k + '0'));
                        if (sb.charAt(0) != '0') {
                            long val = Long.parseLong(sb.toString());
                            if (val >= x && val <= y) ans++;
                        }
                    }
                }
            }
        }
        writer.println(ans);
        writer.flush();
    }

    private static long nextLong() throws IOException {
        tokenizer.nextToken();
        return (long) tokenizer.nval;
    }
}
